package com.example.jksj.bookmanagement.pro.mine.activity;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.example.jksj.bookmanagement.R;
import com.example.jksj.bookmanagement.pro.mine.adapter.LendHistoryAdapter;
import com.example.jksj.bookmanagement.bean.BookLendHistoryBean;
import com.example.jksj.bookmanagement.common.MyActivity;

import java.util.ArrayList;
import java.util.List;

public class LendHistoryActivity extends MyActivity {

    private RecyclerView mRecyclerView;
    private LinearLayoutManager recyclerViewLayoutManager;
    private List<BookLendHistoryBean> bookLendHistoryBeanList;
    private LendHistoryAdapter lendHistoryAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_lend_history;
    }

    @Override
    protected int getTitleBarId() {
        return R.id.tb_lendHistory;
    }

    @Override
    protected void initView() {
        mRecyclerView = findViewById(R.id.recyclerView_lendHistory);
        recyclerViewLayoutManager = new LinearLayoutManager(this);
        recyclerViewLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mRecyclerView.setLayoutManager(recyclerViewLayoutManager);
    }

    @Override
    protected void initData() {
        setLendHistoryList();
        lendHistoryAdapter = new LendHistoryAdapter(bookLendHistoryBeanList);
        mRecyclerView.setAdapter(lendHistoryAdapter);
    }

    public void setLendHistoryList(){
        bookLendHistoryBeanList = new ArrayList<BookLendHistoryBean>(24);
        bookLendHistoryBeanList.add(new BookLendHistoryBean(
                "莫失莫忘",
                "http://e.library.sh.cn/wread2017/_cover/shyw/ShlibEpub_1537322934.jpg",
                "2019/1/4",
                "3个月",
                "2019/3/4"));
        bookLendHistoryBeanList.add(new BookLendHistoryBean(
                "十一种孤独",
                "http://e.library.sh.cn/wread2017/_cover/shyw/ShlibEpub_1512707236.jpg",
                "2018/5/10",
                "3个月",
                "2019/8/10"));
        bookLendHistoryBeanList.add(new BookLendHistoryBean(
                "火星纪事",
                "http://e.library.sh.cn/wread2017/_cover/shyw/ShlibEpub_1512707205.jpg",
                "2018/10/4",
                "2个月",
                "2019/12/4"));
        bookLendHistoryBeanList.add(new BookLendHistoryBean(
                "双重赔偿",
                "http://e.library.sh.cn/wread2017/_cover/shyw/ShlibEpub_1512706913.jpg",
                "2018/2/1",
                "3个月",
                "2018/5/1"));
        bookLendHistoryBeanList.add(new BookLendHistoryBean(
                "流动的盛宴",
                "http://e.library.sh.cn/wread2017/_cover/shyw/ShlibEpub_1512706668.jpg",
                "2018/5/4",
                "1个月",
                "2019/6/4"));
    }
}
